// __
// __/__\_
// O | |
// / \| |
// / /| |
// / | |
//author: PS_455
//header files
#include <bits/stdc++.h>
using namespace std;
//define shortcuts
#define ll long long
#define endl "\n"
#define int ll
#define ld long double
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define vll vector<ll>
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define scanit(a,n) for(ll index1=0; index1<n; index1++) cin>>a[index1];
#define printit(a,n) for(ll index1=0; index1<n; index1++) cout<<a[index1]<<" ";
#define precision(a) cout<<fixed<<setprecision(a)
#define FASTO ios_base::sync_with_stdio(false); cin.tie(NULL);
//functions
int __gcd(int a, int b) { if(b == 0){return a;} return __gcd(b, a % b); }
ll binpow(ll a, ll b) { ll res = 1; while (b > 0){ if(b & 1){res = (res * a);} a = (a * a) ; b >>= 1; } return res; }
bool isPrime(ll n){ if(n<=1) return false; if(n<=3) return true; if(n%2==0 || n%3==0) return false; ll p = sqrt(n); for(int i=5; i<=p; i=i+6){ if(n%i==0 || n%(i+2)==0) return false;} return true;}
void remove(vector<int> &v){auto end = v.end();for(auto it = v.begin(); it != end; ++it){end = std::remove(it + 1, end, *it);} v.erase(end, v.end()); }
const ll M = 1000000007;
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
void solve(){
int n;
cin>>n;
int ans=0;
vector<int> v(n);
scanit(v,n);
for(int i=0; i<n-1; i++){
if(v[i]%2==v[i+1]%2) ans+=1;
}
cout<<ans<<endl;
}
int32_t main(){
FASTO
int t=1;
cin>>t;
while(t--){
solve();
}
return 0;
}
17A - Noldbach problem | 1350A - Orac and Factors |
1373A - Donut Shops | 26A - Almost Prime |
1656E - Equal Tree Sums | 1656B - Subtract Operation |
1656A - Good Pairs | 1367A - Short Substrings |
87A - Trains | 664A - Complicated GCD |
1635D - Infinite Set | 1462A - Favorite Sequence |
1445B - Elimination | 1656C - Make Equal With Mod |
567A - Lineland Mail | 1553A - Digits Sum |
1359B - New Theatre Square | 766A - Mahmoud and Longest Uncommon Subsequence |
701B - Cells Not Under Attack | 702A - Maximum Increase |
1656D - K-good | 1426A - Floor Number |
876A - Trip For Meal | 1326B - Maximums |
1635C - Differential Sorting | 961A - Tetris |
1635B - Avoid Local Maximums | 20A - BerOS file system |
1637A - Sorting Parts | 509A - Maximum in Table |